<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\api\validate\v1\order;

use think\Validate;

class OrderAddressValidate extends Validate
{
    protected $rule = [
        'address_id' => 'require',
        'real_name' => 'require|max:32',
        'phone' => 'require',
        'detail' => 'require|max:256',
        'is_default' => 'require|in:0,1',
    ];

    protected $message = [
        'address_id.require' => '地址ID必传',
        'real_name.require' => '收货人姓名必填',
        'real_name.max' => '收货人姓名最大为32字符',
        'phone.require' => '收货人电话必填',
        'detail.require' => '收货人地址必填',
        'detail.max' => '收货人最多为256字符',
        'is_default.require' => '地址是否默认必选',
        'is_default.in' => '地址是否默认传值错误',
    ];

    protected $scene = [
        'add' => ['real_name', 'phone', 'detail', 'is_default'],
        'view' => ['address_id'],
        'edit' => ['address_id'],
        'delete' => ['address_id'],
    ];
}